package cn.org.seventh.web.tag;

import javax.servlet.jsp.tagext.BodyTagSupport;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ResourceBundleMessageSource;

import cn.org.seventh.web.common.SpringContextUtils;

/**
 * @author <a href="mailto:ji.li@symbio-group.com">Andy</a>
 * @since Dec 3, 2007 10:54:06 AM
 */
public abstract class BaseTag extends BodyTagSupport {

	protected ResourceBundleMessageSource getMessageSource() {
		return (ResourceBundleMessageSource) getBean("messageSource");
	}

	protected final Object getBean(String name) {
		ApplicationContext ctx = SpringContextUtils.getWebApplicationContext(
				pageContext.getRequest(), pageContext.getServletContext());
		return ctx.getBean(name);
	}
}
